﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace YFrameWork.RunTime
{

    public interface IResourceManager
    {
        /// <summary>
        /// 加载资源
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="path"></param>
        /// <returns></returns>
        T LoadResource<T>(string path) where T : Object;
        /// <summary>
        /// 释放资源
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="destoryObj"></param>
        bool ReleaseResource(Object obj, bool destoryObj = false);

        /// <summary>
        /// 释放资源
        /// </summary>
        /// <param name="item"></param>
        /// <param name="destoryObj"></param>
        /// <returns></returns>
        bool ReleaseResource(ResourceItem item, bool destoryObj = false);

        /// <summary>
        /// 删除资源
        /// </summary>
        /// <param name="item"></param>
        /// <param name="destoryCache"></param>

        void DestoryResourceItem(ResourceItem item, bool destoryCache = false);
    }

    public class ResourceItem
    {
        public uint Crc;
        public int m_Guid;
        public string Path;
        public Object obj;
        public int RefCount;
        public float m_LastUserTime;

    }
}